version			14
clear			all
set				more off

/* THE FILE GENERATES FIGURE A.I PANEL A OF WASEEM (2019) RESTAT */

matrix 			input tax_rates=(0.5 ,1   ,   2,  3,  4,  5,7.5,10 ,12.5,15,19,21  ,  25, 0, 0, 0  ,    0,   0, 0, 0\						///
								 0.25,0.5 ,0.75,1.5,2.5,3.5,4.5,6  , 7.5, 9,10,11  ,12.5,14,15,16  , 17.5,18.5,19,20\						///	
								 0.5 ,0.75,1.5 ,2.5,3.5,4.5,6  ,7.5,   9,10,11,12.5,	 14,15,16,17.5,	18.5,  19,20, 0\						///
								 7.5 ,10  ,  15,20 , 25,0  ,0  ,0  ,0   ,0 , 0,   0,   0, 0, 0,   0,    0,   0, 0, 0)

set				obs 5000
g				taxableinc=_n/10
expand			6
sort			taxableinc
egen			year=fill(2006 2007 2008 2009 2010 2011 2006 2007 2008 2009 2010 2011)
g				tau=0
local 			i=1
foreach 		z in 100 110 125 150 175 200 300 400 500 600 800 1000 1300 { 
					replace tau=tax_rates[1,`i'] if taxableinc > (`z') & (year==2006 | year==2007 |year==2008 |year==2009) 
					local i=`i'+1
}
local 			i=1
foreach 		z in 300 500 750 1000 1500  { 
					replace tau=tax_rates[4,`i'] if taxableinc > (`z') & (year==2010 | year==2011) 
					local i=`i'+1
}
replace 		tau=0 if taxableinc<=350 & year==2011 
replace 		tau=. if taxableinc==.
replace 		tau=0 if taxableinc<=0
reshape 		wide tau, i(taxableinc) j(year)
#d				;
twoway  		(line  tau2009 taxableinc,sort clcolor(navy) lwidth(thick))
				(line  tau2010 taxableinc,sort clcolor(maroon)  lwidth(thick) lpattern(longdash))
				(line  tau2011 taxableinc,sort clcolor(green)  lwidth(thick) lpattern(shortdash)),
				xtitle(Taxable Income in PKR 000s) xtitle(, alignment(top))
				xlabel(0(50)500)
				ytitle(Average Tax Rate (%)) yscale(titlegap(*10))
				ylabel(0(2.5)10)
				legend(region(style(none)) label(1 "2006-09") label(2 "2010") label(3 "2011")
				rows(1)) 
				graphregion(fcolor(white) style(none) color(white) margin(0 2 0 2)) bgcolor(white);
graph 			export "$project_graph\FigureAIPanelA.eps", replace;
#d 				cr

